// --------------------------------------------------------------------------------------------------------------------
// <copyright file="DepthParameters.cs" company="Microsoft Corporation">
// The MIT License (MIT)
// 
// Copyright (c) 2014, Microsoft Corporation
// 
// Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
// 
// The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
//  THE SOFTWARE.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Microsoft.Robotics.Vision.Cameras
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.Serialization;
    using System.Text;
    using System.Threading.Tasks;

    using Microsoft.Robotics.Numerics;

    /// <summary>
    /// Class that contains the intrinsics of a camera
    /// </summary>
    [DataContract]
    public class DepthParameters : CameraParameters
    {
        /// <summary>
        /// Initializes a new instance of the DepthParameters class
        /// </summary>
        /// <param name="intrinsics">The intrinsics of the camera</param>
        /// <param name="lensDistortion">The lens distortion</param>
        /// <param name="horizontalFieldOfViewInRadians">The horizontal field of view in radians</param>
        /// <param name="verticalFieldOfViewInRadians">The vertical field of view in radians</param>
        /// <param name="pose">The pose of the camera</param>
        /// <param name="tooFar">The to far value</param>
        /// <param name="tooNear">The to near value</param>
        /// <param name="noReading">No reading value</param>
        public DepthParameters(
             Matrix3 intrinsics = null,
            LensDistortion lensDistortion = null,
            double horizontalFieldOfViewInRadians = 0,
            double verticalFieldOfViewInRadians = 0,
            Pose pose = new Pose(),
            short tooFar = short.MaxValue,
            short tooNear = short.MinValue,
            short noReading = 0)
            : base(intrinsics, lensDistortion, horizontalFieldOfViewInRadians, verticalFieldOfViewInRadians, pose)
        {
            this.TooFarDepth = tooFar;
            this.TooNearDepth = tooNear;
            this.NoReadingValue = noReading;
        }

        /// <summary>
        /// Initializes a new instance of the DepthParameters class from an existing set of parameters
        /// </summary>
        /// <param name="other">Base depth parameter setting</param>
        public DepthParameters(DepthParameters other) :
            base(other.Intrinsics, other.DistortionParameters, other.HalfHorizontalFieldOfViewInRadians, other.HalfVerticalFieldOfViewInRadians, other.Pose)
        {
            this.TooFarDepth = other.TooFarDepth;
            this.TooNearDepth = other.TooNearDepth;
            this.NoReadingValue = other.NoReadingValue;
        }        

        /// <summary>
        /// Gets the too far value
        /// </summary>
        [DataMember]
        public short TooFarDepth { get; private set; }

        /// <summary>
        /// Gets the too near value
        /// </summary>
        [DataMember]
        public short TooNearDepth { get; private set; }

        /// <summary>
        /// Gets the no reading value
        /// </summary>
        [DataMember]
        public short NoReadingValue { get; private set; }
    }
}
